package com.lemon.smartsafety.ui.adapter.hidden.list;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.lemon.smartsafety.listener.RecyclerTClickListener;
import com.lemon.safecloud.greendao.HiddenDangerInfo;

import java.util.List;

import kale.adapter.LemonRcvAdapter;
import kale.adapter.item.AdapterItem;

/**
 * Created by Cooliean on 16/2/22.
 * 隐患列表适配
 */
public class HiddenListAdapter extends LemonRcvAdapter<HiddenDangerInfo> {
    private RecyclerTClickListener<HiddenDangerInfo> mListener;


    private HiddenListItem mItem = null;

    public HiddenListAdapter(@Nullable List<HiddenDangerInfo> data, RecyclerTClickListener<HiddenDangerInfo> listener) {
        super(data);
        mListener = listener;
    }

    private HiddenListAdapter(@Nullable List<HiddenDangerInfo> data) {
        super(data);
    }


    @Override
    public Object getItemType(HiddenDangerInfo data) {
        return -1;
    }


    @NonNull
    @Override
    public AdapterItem createItem(Object type) {
        return getListItem();
    }


    private HiddenListItem getListItem() {
        if(mItem !=null )return mItem;
        else return new HiddenListItem(mListener);
    }
}
